home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / antiair_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2006-02-21  |  6.6 KB  |  194 lines

  1.  
  2. function units_antiair_alien_shieldUp(unit)
  3.     unit:play3DSound("antiair alien shield up.wav",0)
  4.     unit:addAnimationToQueue(ENAT_IDLETIMEOUT1,1)
  5.     while unit:getCurrentAnimation() ~= ENAT_IDLE do
  6.         pause()
  7.     end
  8.     unit:play3DSound("antiair alien field 0.wav",0)
  9.     unit:getBone(ENBT_FAN,0):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,MATH_PI / 4)
  10.     unit:getBone(ENBT_FAN,0):addSimpleEffect(ENET_EFFECT_GEOMETRY_AA_ALIEN_KUPOL)
  11. end
  12.  
  13. function units_antiair_alien_shieldDown(unit)
  14.     unit:play3DSound("antiair alien shield down.wav",0)
  15.     unit:addAnimationToQueue(ENAT_IDLETIMEOUT2,1)
  16.     local shieldBone = unit:getBone(ENBT_FAN,0)
  17.     shieldBone:killEffect(ENET_EFFECT_ROTATE_RADAR)
  18.     shieldBone:killEffect(ENET_EFFECT_GEOMETRY_AA_ALIEN_KUPOL)
  19. end
  20.  
  21. function units_antiair_alien_setup()
  22.     local unit = uniGetExecutor()
  23.     unit:resetAnimations()
  24.     local owner = uniGetTarget()
  25.     if(owner) then
  26.         unit:setTransformOwner(units_findfreefirespot(owner,1))
  27.         unit:setLocalPosition(0,0,0)
  28.         unit:setLocalOrientation(0,1,0,0,0,1)
  29.         if(owner:getIsPlacesVisible() == false) then
  30.             unit:setVisibility(false,false)
  31.         end
  32.     end
  33.     if owner ~= nil then
  34.         if owner:getIsPlacesVisible() then owner = nil end
  35.     end
  36.     if owner == nil then units_antiair_alien_shieldUp(unit) end
  37.     units_setup(3,true,nil,ENET_EFFECT_GEOMETRY_ANTIAIRALIEN_SHADOW,true,false)
  38. --[[
  39.     local unit = uniGetExecutor()
  40.     unit:play3DSound("setup.wav",0)
  41.     if uniGetTarget() == nil then units_antiair_alien_shieldUp(unit) end
  42.     units_setup(3,true,nil,ENET_EFFECT_GEOMETRY_ANTIAIRALIEN_SHADOW,true,false)
  43. ]]--
  44. end
  45.  
  46. function units_antiair_alien_resetup()
  47.     local unit = uniGetExecutor()
  48.     unit:resetAnimations()
  49.     local owner = uniGetTarget()
  50.     if(owner) then
  51.         unit:setTransformOwner(units_findfreefirespot(owner,1))
  52.         unit:setLocalPosition(0,0,0)
  53.         unit:setLocalOrientation(0,1,0,0,0,1)
  54.         if(owner:getIsPlacesVisible() == false) then
  55.             unit:setVisibility(false,false)
  56.         end
  57.     end
  58.     if owner ~= nil then
  59.         if owner:getIsPlacesVisible() then owner = nil end
  60.     end
  61.     if owner == nil then units_antiair_alien_shieldUp(unit) end
  62.     units_setup(3,true,nil,ENET_EFFECT_GEOMETRY_ANTIAIRALIEN_SHADOW,true,false)
  63. --[[
  64.     uniGetExecutor():resetAnimations()
  65.     if uniGetTarget() == nil then units_antiair_alien_shieldUp(uniGetExecutor()) end
  66.     units_setup(3,true,nil,ENET_EFFECT_GEOMETRY_ANTIAIRALIEN_SHADOW,true,false)
  67. ]]--
  68. end
  69.  
  70. function units_antiair_alien_select()
  71.     units_select(12,1)
  72. end
  73.  
  74. function units_antiair_alien_unselect()
  75.     units_unselect()
  76. end
  77.  
  78. function units_antiair_alien_selectenemy()
  79.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  80. end
  81.  
  82. function units_antiair_alien_damaged()
  83.     uniGetExecutor():applyDamage(uniGetLife())
  84. end
  85.  
  86. function units_antiair_alien_highlight()
  87.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  88. end
  89.  
  90. function units_antiair_alien_explode()
  91.     units_explode_big1()
  92.     uniGetExecutor():getBone(ENBT_FAN,0):killEffect(ENET_EFFECT_GEOMETRY_AA_ALIEN_KUPOL)
  93. end
  94.  
  95. function units_antiair_alien_fire()
  96. end
  97.  
  98. function units_antiair_alien_move()
  99.     local unit = uniGetExecutor()
  100.     units_antiair_alien_shieldDown(unit)
  101.     unit:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
  102.     while unit:getCurrentAnimation() ~= ENAT_GO do
  103.         pause()
  104.     end
  105.     local sound = unit:play3DSound("aniair turn.wav",1)
  106.  
  107.     local steps = {}
  108.     local i = 0;
  109.     for i = 0,1 do
  110.         steps[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_LIGHTTANKSTEPSEMITTER)
  111.         steps[i+2] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE2)
  112.     end
  113.  
  114.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.45))
  115.     sound:destroy()
  116.     sound = unit:play3DSound("lighttank_alien_move.wav",1)
  117.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
  118.     unit:setCurrentAnimationRepeatCount(1)
  119.     units_antiair_alien_shieldUp(unit)
  120.     sound:destroy()
  121.  
  122.     for i = 0,1 do
  123.         if(unit:getScale() < 1.0) then 
  124.             steps[i]:destroy()
  125.         else
  126.             steps[i]:setTransformOwner()
  127.             steps[i]:suspendedDestroy(70)
  128.         end
  129.         steps[i+2]:suspendedDestroy(1.0)
  130.     end
  131.  
  132. end
  133.  
  134. -- register functions to unit scriptset - they will be called when specified command arrives to unit
  135. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_MOVE,"units_antiair_alien_move")
  136. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_FIRE1,"units_antiair_alien_fire")
  137. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_FIRE2,"units_antiair_alien_fire")
  138. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_SELECT,"units_antiair_alien_select")
  139. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_SELECTENEMY,"units_antiair_alien_selectenemy")
  140. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_UNSELECT,"units_antiair_alien_unselect")
  141. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_SETUP,"units_antiair_alien_setup")
  142. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_RESETUP,"units_antiair_alien_resetup")
  143. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_DAMAGED,"units_antiair_alien_damaged")
  144. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_EXPLODE,"units_antiair_alien_explode")
  145. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_HIGHLIGHT,"units_antiair_alien_highlight")
  146. registerCommand(ENSCRIPTSET_ANTIAIR_ALIEN,ENC_INSIDE,"units_inside")
  147.  
  148. -- make description of unit
  149. desc = getEffectDescriptionP(ENET_UNIT_ANTIAIR_ALIEN)
  150. desc.ClassID = ENCLASS_MESHINSTANCE
  151. desc.EffectClassType = ENECT_GEOMETRY
  152. desc.FileName = "antiair_alien.rmd"
  153. desc.ScriptSet = ENSCRIPTSET_ANTIAIR_ALIEN
  154. desc.MoveType = ENMOVE_GROUNDORIENTED
  155. desc.RenderType = ENRENDERTYPE_GEOMETRY
  156. desc.Material = ENMAT_RIGIDSKINNEDMESH
  157. desc.MaterialColors = units_materialcolors_human
  158.  
  159. -- shadow
  160. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_ANTIAIRALIEN_SHADOW)
  161. desc.ClassID = ENCLASS_MESHINSTANCE
  162. desc.EffectClassType = ENECT_GEOMETRY
  163. desc.FileName = "antiair_alien_shadow.rmd"
  164. desc.RenderType = ENRENDERTYPE_SHADOW
  165. desc.Material = ENMAT_SHADOW
  166. desc.MaterialColors = units_materialcolors_shadow
  167.  
  168. -- register new unit to logic
  169. unitDesc = logic_getUnitDescP(31)
  170. unitDesc.group = 2
  171. unitDesc.order = 5
  172. unitDesc.unit_res_id = ENET_UNIT_ANTIAIR_ALIEN
  173. unitDesc.unit_icon_id = "Antiair_a_small_normal.dds"
  174. unitDesc.active_id = "Antiair_a_small_active.dds"
  175. unitDesc.pressed_id = "Antiair_a_small_pressed.dds"
  176. unitDesc.small_icon_id = "Antiair_l_stats.dds"
  177. unitDesc.big_icon_id = "Antiair_a_big_normal.dds"
  178. unitDesc.HP = 4
  179. unitDesc.MP = 10
  180. unitDesc.WR = 1
  181. unitDesc.min_WR = 0
  182. unitDesc.WD = 0
  183. unitDesc.WR2 = 0
  184. unitDesc.min_WR2 = 0
  185. unitDesc.WD2 = 0
  186. unitDesc.ability = 0
  187. unitDesc.transport = 0
  188. unitDesc.value = 3
  189. unitDesc.race = 1
  190. unitDesc.fire_pause = 0.6
  191. unitDesc.move_pause = 0.5
  192. unitDesc.unit_info_scale = 0.07
  193. unitDesc.scn_name = "PTEROSHIELD"
  194.